package com.zj.fx.service.month;

import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zj.fx.common.base.BaseService;
import com.zj.fx.common.support.ConvertUtil;
import com.zj.fx.mapper.month.MonthRejectDtlMapper;
import com.zj.fx.model.custom.Tablepar;
import com.zj.fx.model.month.MonthRejectDtl;
import com.zj.fx.model.month.MonthRejectDtlExample;
import com.zj.fx.util.SnowflakeIdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 月评价任务驳回操作记录明细 MonthRejectDtlService
 * @Title: MonthRejectDtlService.java 
 * @Package com.zj.fx.service 
 * @author SQL_自动生成
 * @email ${email}
 * @date 2023-07-13 10:53:28  
 **/
@Service
public class MonthRejectDtlService implements BaseService<MonthRejectDtl, MonthRejectDtlExample> {
    @Autowired
    private MonthRejectDtlMapper monthRejectDtlMapper;

                                                                
    /**
     * 分页查询
     * @param
     * @param
     * @return
     */
    public PageInfo<MonthRejectDtl> list(Tablepar tablepar,MonthRejectDtl monthRejectDtl) {
            MonthRejectDtlExample testExample = new MonthRejectDtlExample();
        //搜索
        if (StrUtil.isNotEmpty(tablepar.getSearchText())) {//小窗体
            testExample.createCriteria().andLikeQuery2(tablepar.getSearchText());
        } else {//大搜索
            testExample.createCriteria().andLikeQuery(monthRejectDtl);
        }
        //表格排序
        //if(StrUtil.isNotEmpty(tablepar.getOrderByColumn())) {
        //	testExample.setOrderByClause(StringUtils.toUnderScoreCase(tablepar.getOrderByColumn()) +" "+tablepar.getIsAsc());
        //}else{
        //	testExample.setOrderByClause("id ASC");
        //}
        PageHelper.startPage(tablepar.getPage(), tablepar.getLimit());
        List<MonthRejectDtl> list = monthRejectDtlMapper.selectByExample(testExample);
        PageInfo<MonthRejectDtl> pageInfo = new PageInfo<MonthRejectDtl>(list);
        return pageInfo;
    }
    
        @Override
        public int deleteByPrimaryKey(String ids) {
            
                List<String> lista = ConvertUtil.toListStrArray(ids);
                    MonthRejectDtlExample example = new MonthRejectDtlExample();
                example.createCriteria().andIdIn(lista);
                return monthRejectDtlMapper.deleteByExample(example);

            
        }


        @Override
        public MonthRejectDtl selectByPrimaryKey(String id) {
            
                return monthRejectDtlMapper.selectByPrimaryKey(id);
            
        }


        @Override
        public int updateByPrimaryKeySelective(MonthRejectDtl record) {
            return monthRejectDtlMapper.updateByPrimaryKeySelective(record);
        }

    
    /**
     * 添加
     */
    @Override
    public int insertSelective(MonthRejectDtl record) {
        
            //添加雪花主键id
            record.setId(SnowflakeIdWorker.getUUID());

        
        return monthRejectDtlMapper.insertSelective(record);
    }


    @Override
    public int updateByExampleSelective(MonthRejectDtl record, MonthRejectDtlExample example) {

        return monthRejectDtlMapper.updateByExampleSelective(record, example);
    }


    @Override
    public int updateByExample(MonthRejectDtl record, MonthRejectDtlExample example) {

        return monthRejectDtlMapper.updateByExample(record, example);
    }

    @Override
    public List<MonthRejectDtl> selectByExample(MonthRejectDtlExample example) {

        return monthRejectDtlMapper.selectByExample(example);
    }


    @Override
    public long countByExample(MonthRejectDtlExample example) {

        return monthRejectDtlMapper.countByExample(example);
    }


    @Override
    public int deleteByExample(MonthRejectDtlExample example) {

        return monthRejectDtlMapper.deleteByExample(example);
    }


}
